

#include "stdafx.h"
#include "CAblationParameterEx.h"
#include "CSomeDataProcessor.h"


PBYTE CSomeDataProcessor::Process(CAblationParameterEx & f_objCAblParamEx)
{

	INT32 l_iBufferSize = f_objCAblParamEx.GetAblationParamCount()*sizeof(INT32);

	PBYTE l_pucData = new BYTE[l_iBufferSize];

	INT32 l_iCurIndex = 0;

	while(FALSE == f_objCAblParamEx.IsListEmpty())
	{
		CChannel l_objCChannel = f_objCAblParamEx.GetNextChannel();
		list<string> l_lstKeys = l_objCChannel.GetParameterList();
		list<string>::iterator itr = l_lstKeys.begin();

		cout<<"------------------------------------------------------------------\n";
		for(;l_lstKeys.end() != itr;++itr)
		{
			INT32 l_iValue = l_objCChannel.GetParameter(*(itr));
			memcpy((l_pucData + l_iCurIndex),&l_iValue,sizeof(INT32));
			l_iCurIndex += sizeof(INT32);

			cout<<"Parameter: " << *(itr) <<" Value: " <<l_iValue <<" Index Loc: " << l_iCurIndex << "\n" ;
		}
	}

	for(int index = 0 ; index < l_iBufferSize ; index += 4)
	{
		INT32 l_iValue = 0;
		memcpy(&l_iValue,(l_pucData + index),sizeof(INT32));
		cout<<(index)<<": "<<l_iValue<<"\n";
	}

	return l_pucData;
}